using DailyPoetryX.AzureStorage;
using DailyPoetryX.AzureStorage.Services;
using DailyPoetryX.AzureStorage.Services.Implementations;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

[assembly: FunctionsStartup(typeof(Startup))]

namespace DailyPoetryX.AzureStorage {
    public class Startup : FunctionsStartup {
        public override void Configure(IFunctionsHostBuilder builder) {
            builder.Services
                .AddSingleton<IAzureStorageAccountProvider,
                    AzureStorageAccountProvider>();
            builder.Services.AddSingleton<ITokenCache, TableTokenCache>();
            builder.Services
                .AddSingleton<IAuthenticationService, AuthenticationService>();
            builder.Services
                .AddSingleton<IAuthorizationService, TableAuthorizationService
                >();
            builder.Services
                .AddSingleton<IFavoriteStorage, BlobFavoriteStorage>();
        }
    }
}